package com.hht.wblib.optoma;

import android.content.ComponentName;
import android.content.Context;
import android.net.Uri;
import android.text.TextUtils;

import com.hht.wblib.bean.ConfigurationBean;
import com.hht.wblib.listener.WhiteBoardImp;
import com.hht.wblib.utils.IntentHelps;

import java.io.File;

/**
 * Author:chen'hu
 * Time:2025/1/2 14:43
 * Description:This is OptomaWhiteBoard
 */
public class OptomaWhiteBoard extends WhiteBoardImp {

    public OptomaWhiteBoard(Context context, ConfigurationBean configurationBean) {
        super(context, configurationBean);
    }

    @Override
    public boolean sendPicturesToWhiteBoard(File file) {
        return IntentHelps.getInstance(mContext)
                .setIntentConfigurator(intent -> {
                    ComponentName componentName =
                            new ComponentName(whiteBoardBean.getPkgName(),
                                    whiteBoardBean.getClassName());
                    intent.setComponent(componentName);
                    if (null != file && !TextUtils.isEmpty(file.getPath())) {
                        Uri mUri = Uri.parse(file.getPath());
                        intent.setDataAndType(mUri, "image/*");
                    }
                })
                .startActivity();
    }

    @Override
    public boolean openWhiteBoard() {
        return IntentHelps.getInstance(mContext)
                .setIntentConfigurator(intent -> {
                    ComponentName componentName =
                            new ComponentName(whiteBoardBean.getPkgName(),
                                    whiteBoardBean.getClassName());
                    intent.setComponent(componentName);
                })
                .startActivity();
    }

    @Override
    public boolean openAnnotation() {
        return IntentHelps.getInstance(mContext)
                .setIntentConfigurator(intent -> {
                    ComponentName componentName =
                            new ComponentName(annotationBean.getPkgName(),
                                    annotationBean.getClassName());
                    intent.setComponent(componentName);
                })
                .startService();
    }
}
